Historical OE update welcome 2, Revision 3

intro

This sort demo is only impressive to experienced programmers: a newcomer will be baffled at how much code it takes to sort a few numbers. Something simpler but more practical is suggested, such as sorting a sequence of names and ages. Irv

 
   mid = floor(n/2) 
    a = merge_sort(x[1..mid])       -- sort first half of x 
    b = merge_sort(x[mid+1..n])     -- sort second half of x 
 
    -- merge the two sorted halves into one 
    merged = {} 
    while length(a) > 0 and length(b) > 0 do 
        if compare(a[1], b[1]) < 0 then 
            merged = append(merged, a[1]) 
            a = a[2..length(a)] 
        else 
            merged = append(merged, b[1]) 
            b = b[2..length(b)] 
        end if 
    end while 
    return merged & a & b  -- merged data plus leftovers 
end function 
 
procedure print_sorted_list() 
-- generate sorted_list from original_list 
    sequence sorted_list 
     
    original_list = {19, 10, 23, 41, 84, 55, 98, 67, 76, 32} 
    sorted_list = merge_sort(original_list) 
    for i = 1 to length(sorted_list) do 
    	display("Number [] was at position [:2], now at [:2]",  
    	        {sorted_list[i], find(sorted_list[i], original_list), i} 
    	    ) 
    end for 
end procedure 
 
print_sorted_list()     -- this command starts the program 

Euphoria has come a long way since v1.0 was released in July 1993 by Rapid Deployment Software (RDS). There are now enthusiastic users around the world.

Introduction

Yet Another Programming Language?

Euphoria is a very high-level programming language. It is unique among a crowd of conventional languages.

Great Features

  • Open source
  • Free for personal and commercial use
  • Produces royalty-free, stand-alone, programs
  • Multi-platform -- Windows, OS X, Linux, FreeBSD, OpenBSD, NetBSD, ...
  • Provides a choice of multi-platform GUI toolkits: IUP, GTK, wxWindows
  • Syntax colored profiling, debugging and tracing of code
  • Dynamic memory allocation and efficient garbage collection
  • Interfacing to existing C libraries and databases
  • Well-documented, lots of example source-code, and an enthusiastic forum
  • Edit and run convenience

Euphoria is unique

What makes Euphoria unique is a design that uses just two basic data-types -- atom and sequence, and two 'helper' data-types -- object and integer.

  • An atom is single numeric value (either an integer or floating point)
  • A sequence is a list of zero or more objects.
  • An object is a variant type in that it can hold an atom or a sequence.
  • An integer is just a special form of atom that can only hold integers. You can use the integer type for a performance advantage in situations where floating point values are not required.

What follows from this design are some advantages over conventional languages:

Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu